﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace YXShop.Web
{
    public partial class _default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (ChangeHope.WebPage.PageRequest.GetFormString("Option") != string.Empty && ChangeHope.WebPage.PageRequest.GetFormString("OrderId") != string.Empty)
                {
                    string orderId = ChangeHope.WebPage.PageRequest.GetFormString("OrderId");
                    if (ChangeHope.WebPage.PageRequest.GetFormString("Option") == "ConMain")
                    {
                        OrderSea(orderId);
                    }
                    Response.End();

                    return;
                }
                else
                {
                    Response.Write(YXShop.TemplateAction.Common.YXShop_PageContent("default"));
                }
            }
        }
        #region 订单查阅ajax
        private void OrderSea(string OrderId)
        {

            YXShop.BLL.Order.Orders bll = new YXShop.BLL.Order.Orders();
            YXShop.Model.Order.Orders model = bll.GetModel(ChangeHope.Common.StringHelper.InputTexts(OrderId));
            if (model != null)
            {
                Response.Write("订单状态：" + checkOrderStatu(model.OrderStatus) + "<br/>物流状态：" + checkOgisticsStatu(model.OgisticsStatus));

            }
            else
            {
                Response.Write("无此订单!");
            }
        }
        #endregion

        #region 订单状态
        private string checkOrderStatu(object obj)
        {
            string reStr = string.Empty;
            Type orderStatu = typeof(YXShop.Common.OrdersStatusEnum.OrderStatu);
            bool bl = ChangeHope.Common.ValidateHelper.IsNumber(obj.ToString());
            if (bl)
            {
                reStr = Enum.GetName(orderStatu, obj);
            }
            return reStr;
        }
        private string checkPaymentStatu(object obj)
        {
            string reStr = string.Empty;
            Type paymentStatu = typeof(YXShop.Common.OrdersStatusEnum.PaymentStatu);
            bool bl = ChangeHope.Common.ValidateHelper.IsNumber(obj.ToString());
            if (bl)
            {
                reStr = Enum.GetName(paymentStatu, obj);
            }
            return reStr;
        }
        private string checkOgisticsStatu(object obj)
        {
            string reStr = string.Empty;
            Type ogisticsStatu = typeof(YXShop.Common.OrdersStatusEnum.OgisticsStatus);
            bool bl = ChangeHope.Common.ValidateHelper.IsNumber(obj.ToString());
            if (bl)
            {
                reStr = Enum.GetName(ogisticsStatu, obj);
            }
            return reStr;
        }
        #endregion
    }
}
